class NumArray:

    def __init__(self, nums):
        self.sums = [0] * (len(nums) + 1)

        for i in range(1, len(nums)+1):
            self.sums[i] = self.sums[i-1] + nums[i-1]

    def sumRange(self, i, j):
        return self.sums[j+1] - self.sums[i]


